Tableau Prep Tip - Converting Bracketed Numbers to Negatives

The Problem

Data files can come in lots of shapes, sizes, and formats. This is especially the case when working with numbers, as there are lots of ways to format a negative. Traditionally, in Excel, this is done by using a ‘-’, red text colour, and sometimes within brackets.

For example, we will work with the following data set:

Original Data Set

You’ll notice that the values with a negative profit have been inputted with brackets around them. This may be great for accountants… but causes problems in Tableau as they aren’t recognised as negatives (or even numbers!) resulting in the following:

Tableau Import

There are two problems after the import…

1, Profit column has a data type of ‘string’
2, Negative values have brackets around them

The Solution?

Now, this is really easy… all you need to do is change the data type to ‘Number (Decimal)’ and there you have it!

Tableau automatically identifies the bracketed numbers and converts them to negatives.

Pretty neat and a great time saver!

Author:
Tom Prowse
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab